//
//  NoteEditViewVc.swift
//  xiaofenshu
//
//  Created by zhu jinlong on 2021/5/20.
//

import UIKit

class NoteEditViewVc: UIViewController {

    var phones:Array = [UIImage]()
//    var videoUrl: URL = Bundle.main.url(forResource: "testVideo", withExtension: ".mp4")!
    var videoUrl: URL?
    ///计算属性只读属性  切返回不变的话 不会重复执行闭包内容 节省资源
    var phoneCount : Int{ phones.count }
    var isVideo : Bool{videoUrl != nil }
    
    @IBOutlet weak var phoneCollectionView: UICollectionView!
    @IBOutlet weak var titleField: UITextField!
    @IBOutlet weak var titleCountLabel: UILabel!
    @IBOutlet weak var subTitleField: UITextView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        phoneCollectionView.dragInteractionEnabled = true
        hideKeyboardWhenTappedAround()
    }
    
}

extension NoteEditViewVc:UITextFieldDelegate {
    func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
        titleCountLabel.isHidden = false
        return true
    }
    
    func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
        titleCountLabel.isHidden = true
        return true
    }
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        return true
    }
}


